Skip to content

stewards: evidence reader on ambient kubectl behind a strict allowlist (BB-419) - #464

Merged
trotterdylan merged 1 commit into
mainfrom
bb/bb-419-evidence-reader-on-ambient-kubectl-drop-o-thr_ij4x3j8iuy
Dec 1, 2026
Merged

trotterdylan merged 1 commit into
mainfrom
bb/bb-419-evidence-reader-on-ambient-kubectl-drop-o-thr_ij4x3j8iuy

Conversation

@trotterdylan

Copy link
Copy Markdown
Collaborator

Implements BB-419. The owner settled the scope change on the ticket (the 2026-12-01 comment, "Scope change (settled by the owner)"): the evidence reader needs no separate credential. It now reads with the kubectl access the server's threads already have, behind the ops kind's kubectlRefusal and a stricter evidenceKubectlRefusal on top of it. This is the follow-up to #463 (merge 18ce575); the Slack reply path is still BB-420.

A merge to bb-plugins main moves the pin, builds a new bb-server image and stages a restart for every developer's server (.bb/AGENTS.md, "Shipping a plugin change"). It restarts in the quiet window unless someone presses Restart now.

Sibling PR: none.

Classification

owner-reviewed: this changes access behaviour — the plugin's evidence path now uses the ambient kubectl identity, and evidenceKubectlRefusal is what bounds it. The decide list's access entry ("Granting a new credential, token or cluster access to any server or agent, or widening what an existing one can reach") is the owner's, and the owner settled it in the ticket comment above. bb-plugins/plugins/stewards/** is otherwise project-decided.

What changes

  • server.ts: removes the opsEvidenceKubeconfig secret setting. No other change; store.ts untouched.
  • host.ts / host-contract.ts: removes the kubeconfig-loading path — the private temp file, the evidenceKubeconfig host-contract field and the KubectlGate exception. The host runs the ambient kubectl behind kubectlRefusal as before.
  • evidence.ts: createEvidenceReader({ namespaces, kubectl }) reads with the ambient config. Every call passes evidenceKubectlRefusal; a namespace outside the configured pilot list, an empty list (the reader's off state), or a refused/forbidden read throws EvidenceUnavailableError, so the composer labels evidence unavailable. No token or kubeconfig value is read or printed.
  • kubectl.ts: adds evidenceKubectlRefusal, a strict allowlist on top of kubectlRefusal — only get on jobs, pods and events and logs (pods/log), one configured namespace, -o json only; no secrets or configmaps, no write/exec/proxy verb, no --all-namespaces, no credential, identity or output flag.
  • triage.ts: comments only, to match the settled identity.

Testing

  • plugins/stewards: npm run typecheck pass; npm test pass (62 files, 2607 tests).
  • kubectl.test.ts: new evidenceKubectlRefusal cases admit the reader's four reads and refuse secrets, configmaps, delete/apply/edit/patch/exec/port-forward/proxy/create/replace/scale/rollout/auth, --all-namespaces/-A, a missing or foreign namespace, an empty pilot list, non-json -o, a missing container and a non-numeric tail, plus a credential, identity or --raw flag.
  • evidence.test.ts: happy path, missing Job/logs as missing reads, forbidden read, namespace outside the list, the off state (empty list) with no kubectl call, non-resource Job name, token redaction, and the recent-Jobs cap.
  • Not tested end to end: the live cluster read (no caller yet; the Slack path is BB-420) and the Slack post.

— from bb thread thr_ij4x3j8iuy

…t (BB-419)

The owner settled the scope change: the Job-failure triage reply needs no
separate credential. Its evidence reader now uses the kubectl access the
server's threads already have, behind the ops kind's kubectlRefusal and a
new, stricter evidenceKubectlRefusal on top of it.

Because the ambient identity is not read-only, evidenceKubectlRefusal is a
strict allowlist: only get on jobs, pods and events, and logs (pods/log), in
one configured pilot namespace, -o json only. No secrets or configmaps, no
write/exec/proxy verb, no --all-namespaces, and no credential, identity or
output flag. An empty pilot namespace list is the off state, so the reader
reads nothing until a namespace is configured.

Removes the opsEvidenceKubeconfig secret setting and the whole
kubeconfig-loading path (the host temp file, the KubectlGate exception, the
host-contract field). server.ts loses only the setting; store.ts is
untouched. No backend.json, kploy, ServiceAccount or RBAC change.
@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Independent review running in bb thread @thread:thr_p49whvqyxh.

— from bb thread thr_ij4x3j8iuy

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Review round 1 (GLM 5.3, at b72cfcb)

Owner review required: yes — access: the evidence reader moves from a separately scoped kubeconfig to the machine's ambient, non-read-only cluster identity, and a new automated path now reads the cluster through it; evidenceKubectlRefusal is what bounds it, and the deployed opsEvidenceKubeconfig setting is removed. On my reading this hits the decide list's user entry "Granting a new credential, token or cluster access to any server or agent, or widening what an existing one can reach" (bb stewards gate matched only the project stewards entry; the reviewer override applies). @trotterdylan, this one needs your approval: the scope you settled on the ticket decided what was built, but the approval of this diff is yours. The escalation is binding — a project-steward bb-approval will not meet the gate, and your unsigned approval on this pull request will.

Blockers

None. The gate is airtight where it matters: verbs limited to get/logs, resources to jobs/pods/events, exactly one -n from the configured pilot list, -o json only, one -c and a numeric --tail for logs, credential/identity/--raw/--all-namespaces refused through the underlying ops gate, and an empty pilot list refuses everything. The removal is complete — no reference to opsEvidenceKubeconfig, evidenceKubeconfig or KubectlGate survives anywhere in the repo, and store.ts is untouched.

Tested

  • Ran: npm run typecheck and npm test in plugins/stewards (pass: 62 files, 2607 tests — CI's stewards check was still in progress).
  • Verified off-diff, against the live bc-prod context with nonexistent objects: kubectl itself rejects get <bare-type> <TYPE/NAME> positionals (with and without --), so a positional such as secrets/x cannot smuggle a resource past the jobs/pods/events allowlist; a bare secrets/x as the first argument fails the gate's resource check.

— from bb thread thr_p49whvqyxh

@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Approved b72cfcb from the Stewards page

@trotterdylan
trotterdylan merged commit 99c7177 into main Dec 1, 2026
25 checks passed
@trotterdylan
trotterdylan deleted the bb/bb-419-evidence-reader-on-ambient-kubectl-drop-o-thr_ij4x3j8iuy branch December 1, 2026 17:41
@trotterdylan

Copy link
Copy Markdown
Collaborator Author

Merged: owner-reviewed lane, reviewer approved b72cfcb, checks green, approved by the owner, escalated by the reviewer to the owner.
merge commit 99c7177
Note: merging this moves the pin and stages a restart for every developer's server (Restart now, or in the 03:00–05:00 ET quiet window).
dispatched bb-server.yaml on bitcomplete/bb-gate@main

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant